package com.finalx.mytp;

import java.util.Set;

import android.os.Bundle;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class Activity_Main extends Activity {

	private static final String TAG = "MainActivity";
	public static final int TEST_PASS = 0;
	public static final int TEST_FAIL = -1;
	public static final int TESTING =  1;
	
	private Button buttonMainDisplayKeyboard = null;
	private Intent mNewActivityIntent = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		buttonMainDisplayKeyboard = (Button) findViewById(R.id.main_button_display_keyboard);
		
		mNewActivityIntent = new Intent();

	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		Bundle dataBundle = data.getExtras();
		Set<String> keySet = dataBundle.keySet();
		for(String oneKey : keySet) {
			int resultValue = (int) dataBundle.getInt(oneKey, TEST_FAIL);
			Log.d(TAG, oneKey + " = " + resultValue);
		}
		
		
		super.onActivityResult(requestCode, resultCode, data);
	}

	public void onMainButtonClick(View v) {
		// TODO Auto-generated method stub
		Log.d(TAG, "onMainButtonClick");
		switch (v.getId()) {
		case R.id.main_button_display_keyboard: {
			mNewActivityIntent.setComponent(new ComponentName(getApplicationContext(), getPackageName()+".ActivityDisplayKeyboard"));
			startActivityForResult(mNewActivityIntent, 0);
			break;
		}
		

		}

	}

}
